package work1.work4;

import java.util.Scanner;

/**
 * @Author admin
 * @Date 2019/3/27 8:38
 */
public class Load {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String strid="wyj123";
        String password="571250";
        String str1,str2;
        boolean pd=false;
        int sum=3;
        for (int i=3;i>0;){
            System.out.println("请输入用户名：");
            str1=in.nextLine();
            System.out.println("请输入密码：");
            str2=in.nextLine();
            if (str1.equals(strid)&str2.equals(password)){
                System.out.println("登陆成功");
                pd=true;
                break;
            }
            else{
                System.out.println("登陆失败");
                sum--;
                i--;
                if (sum==0){
                    System.out.println("登陆失败，账号被锁定，请联系客服");
                }
                else{
                    System.out.println("还剩余"+sum+"次机会");
                }
            }
        }
        if (pd==true){
            int randoms= (int) (Math.random()*100);
            int n=0;
            while (n!=randoms){
                System.out.println("请输入你要猜的数据（1-100）：");
                n=in.nextInt();
                if (n>randoms){
                    System.out.println("你猜的数据"+n+"大了");
                }
                else if (n<randoms){
                    System.out.println("你猜的数据"+n+"小了");
                }
                else{
                    System.out.println("恭喜你，猜中了");
                }
            }

        }
    }
}
